#ifndef KINEMATICCHAIN2008
#define KINEMATICCHAIN2008
#include "../mtxlib/mtxlib.h"
#include "Utilities.h"
#include "Renderable.h"

#define DEG_FR 6
class KinematicChain : public Singleton<KinematicChain>, public Renderable
{

	float _a[DEG_FR];
	mtxlib::vector3 _v[DEG_FR];
	
	mtxlib::vector3 _u[DEG_FR];
	float _w[DEG_FR];
	int _selectedJoint;
public:
	enum JointType { Prismatic, Rotational };
private:
	JointType _jointTypes[DEG_FR];
public:
	bool InteractiveMode;

	KinematicChain();
	
	float &A(int i);
	mtxlib::vector3 &V(int i);
	mtxlib::vector3 &U(int i);
	float &W(int i);
	JointType &JT(int i);

	mtxlib::matrix44 TRP(int i) const;
	mtxlib::matrix44 TRP() const;
	mtxlib::matrix44 TR(int i) const;
	mtxlib::matrix44 TR()const;
	mtxlib::matrix44 P(int i) const;
	mtxlib::matrix44 T(int i) const;
	mtxlib::matrix44 R(int i) const;
	mtxlib::matrix44 R() const;
	mtxlib::matrix44 RP(int i) const;
	mtxlib::matrix44 RP() const;
	void Load(const char *path);
	void Save(const char *path) const;
	void ProcessSelection(int Color);
	int &SelectedJoint();
	void GetRotationalJoints(int &first, int &second, int &third) const;
	void GetPrismaticJoints(int &first, int &second, int &third) const;

};
#endif